<template>
  <div id="home">
    <div>
      <el-row :gutter="15" style="margin: 0px 0px">
        <el-col :span="navMenuSpan" class="nav-left"><div><NavMenu :menuSpan="navMenuSpan"/></div></el-col>
        <el-col :span="24-navMenuSpan" class="main">
          <el-row>
            <el-col :span="24"><Header class="header"/></el-col>
          </el-row>
          <el-row>
            <el-col :span="24"><Main/></el-col>
          </el-row>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import Header from '@/components/header/Header'
import Main from '@/components/main/Main'
import NavMenu from '@/components/navmenu/NavMenu'
import {mapActions, mapGetters} from 'vuex'
// import {fetch} from '@/utils/http'
// import {getUser, setUser} from '@/utils/session'
export default {
  name: 'Home',
  data: function () {
    return {
    }
  },
  components: {
    Header,
    Main,
    NavMenu
  },
  computed: {
    ...mapGetters(['navMenuSpan', 'username', 'userId', 'token'])
  },
  beforeCreate: function () {
    // fetch('long-oauth2-upms/appUser/current', {'access_token': this.token}).then((res) => {
    //   if (res.status === 200) {
    //     let user = getUser()
    //     Object.assign(user, res.data)
    //     setUser(user)
    //     this.setUserId(res.data.id)
    //     this.setResources(this.resources)
    //   }
    // })
  },
  created: function () {
  },
  ...mapActions(['setUserId', 'setRoles', 'setResources'])
}
</script>

<style>
  #home {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
  }
  .main {
    height: calc(100vh);
    overflow: auto;
  }
  .nav-left{
    height: calc(100vh);
    overflow: auto;
  }
  .header {
    height: calc(13vh);
    overflow: auto;
  }
</style>
